package cfdt.common.vo;


import cfdt.common.enums.CommonCodeEnum;
import cfdt.common.enums.ICodeEnum;
import cfdt.common.utils.CommonUtils;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

/**
 * 基础响应类
 *
 * @author sven.wang
 * @since 2025/8/22 15:23
 */
@Data
public class BaseResponse {

    @Schema(description = "响应码")
    private String code = CommonCodeEnum.CODE_SUCCESS.getCode();
    @Schema(description = "响应码描述")
    private String message = CommonCodeEnum.CODE_SUCCESS.getDesc();

    public BaseResponse() {
    }

    public BaseResponse(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public BaseResponse(ICodeEnum codeEnum) {
        this.code = codeEnum.getCode();
        this.message = codeEnum.getDesc();
    }

    public BaseResponse(ICodeEnum codeEnum, Object... errorArgs) {
        this.code = codeEnum.getCode();
        this.message = CommonUtils.getCodeMessage(codeEnum.getDesc(), errorArgs);
    }

}
